<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            Exportar Arquivos do CENSEC
        </ui:define>

        <ui:define name="content">

            <h:form id="exportarCENSECForm">

                <p:messages id="exportarCENSECMessages" autoUpdate="true" />

                <p:fieldset legend="Dados do Imóvel" id="dadosImovelPanel" >

                    <div class="row">
                        <div class="column2">
                            <p:outputLabel value="Central" for="centralSelectOneMenu" />
                        </div>
                        <div class="column8">
                            <p:selectOneMenu id="centralSelectOneMenu" value="#{ managerExportarCENSEC.central }"
                                             required="true" requiredMessage="Central é obrigatório">
                                <f:selectItems value="#{ enums.central() }"></f:selectItems>
                            </p:selectOneMenu>
                        </div>
                    </div>

                    <div class="row">
                        <div class="column2">
                            <p:outputLabel value="Data Inicial" for="dataInicialCalendar" />
                        </div>
                        <div class="column3">
                            <p:calendar id="dataInicialCalendar" value="#{ managerExportarCENSEC.dataInicial }"
                                        required="true" requiredMessage="Central é obrigatório"
                                        showOn="button" pattern="dd/MM/yyyy" locale="pt" navigator="true" />
                        </div>

                        <div class="column2">
                            <p:outputLabel value="Data Final" for="dataFinalCalendar" />
                        </div>
                        <div class="column3">
                            <p:calendar id="dataFinalCalendar" value="#{ managerExportarCENSEC.dataFinal }"
                                        required="true" requiredMessage="Central é obrigatório"
                                        showOn="button" pattern="dd/MM/yyyy" locale="pt" navigator="true" />
                        </div>
                    </div>

                </p:fieldset>

                <div class="command">
                    <p:commandButton
                        id="exportarCommandButton" value="Gerar arquivo" icon="ui-icon-search"
                        styleClass="ui-priority-primary" oncomplete="widthFix();"
                        update="@form" actionListener="#{ managerExportarCENSEC.exportar() }" />
                    <p:commandButton value="Limpar" icon="ui-icon-close" oncomplete="widthFix();"
                                     update="@form" actionListener="#{ managerExportarCENSEC.limpar() }" />
                </div>

                <p:blockUI block="exportarCENSECForm" trigger=":exportarCENSECForm:exportarCommandButton">
                    Exportando...
                </p:blockUI>

            </h:form>

            <script>
                $(document).ready(function() {
                    setSelectedMenu('#ep');
                });
            </script>

        </ui:define>
    </ui:composition>

</html>
